package org.mark.storage.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

@Data
@TableName("t_storage_info")
public class StorageInfo {
    @TableId(type = IdType.AUTO)
    private Integer id;

    private String name;
    private String address;
    private Integer capacity;
    private String status;  // 1常温，2冷藏，3冷冻

    private String createBy;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    private String updateBy;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField(exist = false)
    private Integer pageNum;
    @TableField(exist = false)
    private Integer pageSize;

    // 获取状态名称
    public String getStatusName() {
        if (status == null) return "";
        switch (status) {
            case "1": return "常温";
            case "2": return "冷藏";
            case "3": return "冷冻";
            default: return "未知";
        }
    }
}